const mongoose = require('mongoose')
const bcrypt = require('bcrypt')
const Schema = mongoose.Schema
mongoose.connect('mongodb://localhost/news')
const moment=require('moment')
moment.locale('zh-cn') //设置时区

const UserSchema = new Schema({
  username: {
    type: String,
  },
  email: {
    type: String,
  },
  mobile: {
    type: Number,
  },
  date: {
    type: String,
    default: () => {
      return moment().format('YYYY-MM-DD HH:mm:ss')
    }
  },
  password: {
    type: String
  },
  identity: {
    type: String
  },
})

const User = mongoose.model('user', UserSchema)
module.exports = User